package kr.pe.johnkim.carrotpoint.mobile.controller;

import kr.pe.johnkim.carrotpoint.mobile.domain.CarrotPointBank;
import kr.pe.johnkim.carrotpoint.mobile.service.CarrotPointBankService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Carrot Point 결제 은행 관련 controller 클래스 이다.
 *
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 2. 6.
 */
@Controller
@RequestMapping(value = "/carrotPointBankController")
public class CarrotPointBankController {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(CarrotPointBankController.class);

    @Autowired
    private CarrotPointBankService carrotPointBankService;

    /**
     * 거래 은행 목록을 가져 온다.
     *
     * @param carrotPointBank
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getBankList", method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.OK)
    @ResponseBody
    public List<CarrotPointBank> getBankList
            (@RequestBody CarrotPointBank carrotPointBank) throws Exception {
        logger.info("getBankList");

        return this.carrotPointBankService.getBankList(carrotPointBank);
    }

    /**
     * 거래 은행 정보를 가져 온다.
     *
     * @param carrotPointBank
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getBankInformation", method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.OK)
    @ResponseBody
    public CarrotPointBank getBankInformation
            (@RequestBody CarrotPointBank carrotPointBank) throws Exception {
        logger.info("getBankInformation");

        return this.carrotPointBankService.getBankInformation(carrotPointBank);
    }
}
